package neuroBot.input.party;

import java.awt.Color;
import java.awt.Robot;
import java.awt.event.InputEvent;

import neuroBot.bot.party.Main;
import neuroBot.exploit.party.FrameHandler;

public class WaitListJoiner {
	public Robot rob;

	public FrameHandler frameHandler = new FrameHandler(Main.pokerFrameNr);

	public Color isOvrwrWlVisCol = new Color(7, 50, 1);

	// Konstruktor
	public WaitListJoiner() {
		try {
			rob = new Robot();
			rob.setAutoWaitForIdle(true);
			rob.setAutoDelay(100);
		} catch (Exception e) {
			System.out.println(e);
		}
	}

	// joint die Waitlist
	public void joinWaitList() {
		clickAddToWaitList();
		if (isOverwriteWaitListVisible())
			clickOverwriteWl();
	}

	// clickt auf Add To Waitlist um waitlist zu joinen
	public void clickAddToWaitList() {
		rob.mouseMove(800, 730);
		rob.mousePress(InputEvent.BUTTON1_MASK);
		rob.mouseRelease(InputEvent.BUTTON1_MASK);
	}

	// clickt ok im overwirte waitlist fenster
	public void clickOverwriteWl() {
		rob.mouseMove(615, 560);
		rob.mousePress(InputEvent.BUTTON1_MASK);
		rob.mouseRelease(InputEvent.BUTTON1_MASK);
	}

	// gibt an ob das overwirte waitlist fenster sichtbar ist
	public boolean isOverwriteWaitListVisible() {
		// System.out.println(rob.getPixelColor(615, 560));
		return (rob.getPixelColor(615, 560).equals(isOvrwrWlVisCol));
	}

}
